<?php
declare (strict_types = 1);

namespace app\admin\controller;


use app\BaseController;
use think\facade\Db;
use think\facade\Request;
use think\facade\View;

class Brand extends BaseController
{
    public function brand_list()
    {
        $keywords=Request::get('keywords','','trim,htmlspecialchars,strip_tags');

        $is_hot = Request::get('is_hot','','trim,htmlspecialchars,strip_tags');
        $if_show = Request::get('is_down','','trim,htmlspecialchars,strip_tags');
        $tp = Request::get('tp','','trim,htmlspecialchars,strip_tags');

        $data = [
            'keywords'=>$keywords,
            'is_hot'=>$is_hot,
            'if_show'=>$if_show,
            'tp'=>$tp

        ];

        $rt = \app\admin\model\Brand::pin($data,input('get.'));
////        if($keywords!=""){
////            $rt1->where("brand_name like '%$keywords%'");
////        }
//        if($is_hot!=""){
//            $rt1->where("recommended = $is_hot");
//        }
//        if($if_show!=""){
//            $rt1->where("if_show = $if_show");
//        }
//        if($tp==1){
//            $rt1->where("brand_logo","<>",'');
//        }elseif($tp==2){
//            $rt1->where("brand_logo","");
//        }
//       $rt = $rt1->paginate([
//           'list_rows'=>10,
//
//           'query'=>Request::get(),
//       ]);
//        $page = $rt->render();
//        if($rt->isEmpty()){
////            var_dump($rt->isEmpty());
//            View::assign('rt',$rt);
//        }else{
//            View::assign('rt',$rt);
//        }
//        View::assign('keywords',$keywords);
//        View::assign('is_hot',$is_hot);
//        View::assign('if_show',$if_show);
//        View::assign('tp',$tp);
        View::assign('rt',$rt);
        View::assign($data);
        return View::fetch('');
    }
}